/**
 * 
 */
package sailing.ui.laf;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;

import javax.swing.JComponent;
import javax.swing.plaf.PanelUI;

import cjlite.logger.Logger;

/**
 * @author kevin
 * 
 */
public class TitlePanelUI extends PanelUI {
	private static Logger logger = Logger.thisClass();

	private Color borderOutSideColor = new Color(158, 199, 248);
	private Color borderInnerSideColor = new Color(255, 255, 255,150);
	private Color bgTopColor = new Color(184, 214, 250);
	private Color bgBttomColor = new Color(214, 231, 252);

	private Paint gradientBg;
	//private Stroke whiteLine=new 

	@Override
	public void paint(Graphics g, JComponent c) {
//		logger.trace("component[{0}], width={1},height={2}", c.toString(), c.getSize().getWidth(), c.getSize()
//				.getHeight());

		gradientBg = new GradientPaint(0, 0, bgTopColor, 0, c.getHeight(), bgBttomColor);

		if (Graphics2D.class.isInstance(g)) {
			Graphics2D g2d = (Graphics2D) g;
			g2d.setPaint(gradientBg);
			g2d.fillRect(0, 0, c.getWidth(), c.getHeight());
			g2d.setColor(borderOutSideColor);
			g2d.drawRect(0, 0, c.getWidth()-1, c.getHeight()-1);
			g2d.setColor(borderInnerSideColor);
			g2d.drawLine(1, 1, c.getWidth()-2, 1);
		}

	}
}
